package com.venueproject.mapper;

import com.venueproject.pojo.Account;
import com.venueproject.pojo.Venue;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface VenueMapper {


    @Select("select * from account where username = #{username} and password = #{password}")
    Account entry(@Param("username") String username, @Param("password") String password);

    @Update("update venue set status = !status where id = #{id}")
    void changStatus(@Param("id") int id);


    //查询总记录数
    Long count(@Param("number") String number,@Param("name") String name);
    //分页查询
    List<Venue>page(@Param("start") Integer start, @Param("pageSize") Integer pageSize, @Param("number") String number, @Param("name") String name);


    @Update("update venue set number = #{number} ,name = #{name}, image = #{image}, size = #{size}, location = #{location} " +
            "where id = #{id}")
    void update(Venue venue);

    @Delete("delete from venue where id = #{id}")
    void DeleteByid(@Param("id") int id);

    @Insert("insert into venue(number,name,image,size,location) values(#{number},#{name},#{image},#{size},#{location})")
    void add(Venue venue);

}
